#include <iostream>
#include<unordered_set>


using namespace std;


int T, n; 

int main()
{
	
	cin >> T;
	while(T--)
	{
		unordered_set<int> mp;
		cin >> n;
		while(n--)
		{
			int x;
			scanf("%d", &x);
			if(mp.count(x))
			    continue;
			else
			    cout << x << " ";
			    mp.insert(x);
		}
		cout << endl;
		
	}
	return 0; 
}
